using UnityEngine;
using Cinemachine;

public class RoomTrigger : MonoBehaviour
{
    public CinemachineVirtualCamera virtualCamera; // 关联虚拟摄像机

    private void OnTriggerEnter2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            virtualCamera.Priority = 100; // 设置当前虚拟摄像机的优先级
        }
    }

    private void OnTriggerExit2D(Collider2D other)
    {
        if (other.CompareTag("Player"))
        {
            virtualCamera.Priority = 0; // 恢复虚拟摄像机的优先级
        }
    }
}
